package com.huawei.java.main.deployentity;


import com.huawei.java.main.inputentity.Require;
import com.huawei.java.main.inputentity.VmType;

/**
 * 已处理的请求
 */
public class Vm extends VmType{
    /**
     * @param require
     * @param server
     * @param node 
     */
    public Vm(Require require, Server server, String node) {
        super(require.getVmType().getVMType(),require.getVmType().getCPU(),require.getVmType().getMemory(),require.getVmType().getNodeType());
        this.vmId = require.getVmId();
        this.server = server;
        this.node=node;
    }
    private long vmId;
    private Server server;//部署的服务器
    private String node;//A、B、AB（双节点）

    public Server getServer() {
        return server;
    }

    public void setServer(Server server) {
        this.server = server;
    }

    public void setNode(String node) {
        this.node = node;
    }

    public long getVmId() {
        return vmId;
    }

    public Server getDeployServer() {
        return server;
    }

    /**
     *
     * @return A、B、AB（双节点）
     */
    public String getNode() {
        return node;
    }

    /**
     * 迁移虚拟机，改变该虚拟机所属的服务器和节点
     * @param server
     * @param node
     */
    public void migrate(Server server,String node){
        this.server=server;
        this.node=node;
    }

    @Override
    public String toString() {
        return "Vm{"   +"cpu: "+getCPU()+"  memory: "+getMemory()+
                "vmId=" + vmId +
                ", server=" + server +
                ", node='" + node + '\'' +
                "}\n";
    }
}
